package com.digitalchina.lxnsy.sy.all;

import android.webkit.JavascriptInterface;

import com.digitalchina.lxnsy.base.BaseHtmlActivity;
import com.digitalchina.lxnsy.sy.milkManagement.InvalidRecordActivity;
import com.digitalchina.lxnsy.sy.milkManagement.MilkAddActivity;
import com.digitalchina.lxnsy.sy.milkManagement.MilkDetailsActivity;
import com.digitalchina.lxnsy.sy.milkManagement.QrCodeViewActivity;


public class MilkManagementActivity extends BaseHtmlActivity {
    private int tag = 0;

    @Override
    protected void loadHtml() {
        webView.addJavascriptObject(new JsApi(), null);

        loadUrl("milkManagement");
        setTitle("羊奶销售");
        setRightText("新增");

    }
    @Override
    public void onResume() {
        super.onResume();
        if (tag > 0) {
            callJsMethod("refresh");
        }
        tag++;

    }

    @Override
    public void rightOnClick() {
        go(MilkAddActivity.class);


    }


    public class JsApi {


        @JavascriptInterface
        public void qrCodeView(Object msg) {
            go(QrCodeViewActivity.class);

        }

        @JavascriptInterface
        public void invalidRecord(Object msg) {
             go(InvalidRecordActivity.class);

        }

        @JavascriptInterface
        public void milkDetails(Object msg) {
            go(MilkDetailsActivity.class);

        }



    }
}
